<?php session_start(); ?>
<?php include "libfunc.php";?>
<?php if (!empty($_SESSION['admUser']) && !empty($_SESSION['admPass'])) { ?>
<html>
 <head>
  <title>.: Admin Room ClothingCorp :.</title>
  <link href="admInc/cssMainStyle.css" type="text/css" rel="stylesheet">
  <link href="admInc/cssTableStyle.css" type="text/css" rel="stylesheet">
  <link href="admInc/cssAdditionStyle.css" type="text/css" rel="stylesheet">
  <link href="admInc/cssTableNavigation.css" type="text/css" rel="stylesheet">
 </head>
 <body class="fix">
  <div id="wrapper">
   <div id="header">
    <div class="titleHeader"><center>
     <img src="image/logo2.png" border="0">
	</div><!-- titleHeader //-->
	<div class="subTitleHeader"><center>
	 - Website Administrator Control Panel -
	</div><!-- subTitleHeader //-->
   </div><!-- header //--></center>
   <div id="mainContent">
    <div id="leftColumn">
	 <div class="navigation">
	  <table border="0" width="100%" bgcolor="white">
	  <tr>
	    <td class="headerTable" align="center"><b>Admin Page</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="adminLayout.php"> Halaman Utama</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="newInformation.php"> Informasi Terkini</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="LogOut.php" onClick="return confirm('Apakah Anda benar-benar akan keluar dari halaman Admin ?')"> Keluar</a></td>
	  </tr>
	  <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Kategori</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="tambah_kategori.php"> Tambah Kategori</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_kategori.php"> View Kategori</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_kategori.php"> Pencarian Kategori</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Member</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="tambah_member.php"> Tambah Member</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_member.php"> View Member</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_member.php"> Pencarian Member</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Produk</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="tambah_produk.php"> Tambah Produk</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_produk.php"> View Produk</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_produk.php"> Pencarian Produk</a></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Request Produk</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_request.php"> View Request</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_request.php"> Pencarian Request</a></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Pesanan</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_pesanan.php"> View Pesanan</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_pesanan.php"> Pencarian Pesanan</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	</table>
	 </div><!-- navigation //-->
	</div><!-- leftColumn //-->
	<div id="rightColumn">
	 <div class="content">
	<?php 
	    $id = $_GET['id'];
		//------------------------------Koneksi ke database
		$link = koneksi_db();
		$sql = "select * from dtkategori where id_kategori = $id";
		$res = mysql_query($sql,$link);
		$cek = mysql_num_rows($res);
		//----------------------- end of koneksi ke db
		
		//------------------- Pengecekan apa data ada ? 
		if ($cek<=0) { //------------------------ Jika kategori kosong
	?>
		 <div id="keterangan">
          <fieldset>
          <legend>Keterangan</legend>
           Data Kategori Kosong. <br />
           Silakan Isi Data Kategori!!!
          </fieldset>	  
         </div>
	<?php
        }else{ 
		  $data = mysql_fetch_array($res);
	?>
	     <form action="proses_edit_kategori.php" method="post">
         <fieldset>
          <legend>Form Edit Kategori</legend>
		  <table class="tableTask">
		    <tr>
			  <td width="90">ID Kategori</td>
			  <td width="182"><input type="text" size="26" name="id_kategori" value="<?php echo $data['id_kategori']; ?>" readonly="readonly" class="textStyle"></td>
              <td width="292" class="trInformation">&laquo; id Kategori tidak bisa diedit</td>
			</tr>
			<tr>
			  <td>Nama</td>
			  <td><input type="text" size="26" name="nama_kategori" value="<?php echo $data['nama']; ?>" class="textStyle"></td>
              <td width="292" class="trInformation">&laquo; Silakan ubah nama kategori</td>
			</tr>
			<tr>
			  <td>Deskripsi</td>
			  <td>
                <textarea name="deskripsi_kategori" cols="23" rows="6" class="textStyle">
                  <?php echo $data['deskripsi']; ?>
                </textarea>
              </td>
              <td width="292" class="trInformation">&laquo; Silakan ubah deskripsi kategori</td>
			</tr>
			<tr>
			  <td>Dihapus</td>
			  <td>
			    <input type="radio" name="dihapus" value="Y" <?php if ($data['dihapus']=="Y") echo "checked"; ?>>Ya<br>
				<input type="radio" name="dihapus" value="T" <?php if ($data['dihapus']=="T") echo "checked"; ?>>Tidak
			  </td>
              <td width="292" class="trInformation">&laquo; Silakan ubah pilihan status dari kategori</td>
			</tr>
			<tr>
			  <td></td>
			  <td>
			    <input type="submit" name="update" value="UPDATE" class="buttonStyle">
			    <input type="button" name="update" value="BATAL" onClick="javascript:history.back()" class="buttonStyle">
			  </td>
			</tr>
		  </table>
          </fieldset>
		</form>
      <div id="keterangan">
       <fieldset>
        <legend>Keterangan</legend>
         Form Edit Produk, Silakan Edit atau Ubah field Produk<br>
         Biarkan field bila tidak ingin diubah.
       </fieldset>
      </div>
	<?php
	  }
	?>
	 </div><!-- content //-->
	</div><!-- rightColumn //-->
   </div><!-- mainContent //-->
  </div><!-- wrapper //-->
 </body>
</html>
<?php
}else{
  echo "<script language='javascript'>alert('Silakan Sign In Terlebih Dahulu')</script>";
  echo "<script language='javascript'>window.location = '../admin/'</script>";
}